package leetcode.code1684;

public class Solution {
	public int countConsistentStrings(String allowed, String[] words) {
		int[] hash = new int[128];
		for (int i = 0; i < allowed.length(); i++) {
			hash[allowed.charAt(i)]++;
		}
		int ans = 0;
		for (int i = 0; i < words.length; i++) {
			boolean add = true;
			for (char c : words[i].toCharArray()) {
				if (hash[c] == 0) {
					add = false;
					break;
				}
			}
			ans += add ? 1 : 0;
		}
		return ans;
	}
}
